<?php 
	session_start();
	require('mysql.php');
	if($_SESSION['usertype']=='s'){
	$sql="select authorityid from stuwithauthority where studentid='$_SESSION[usercode]'";
		$result=mysql_query($sql) or die("sql语句连接失败");
		while($row=mysql_fetch_array($result)){
		//	echo $row;
		//	echo $row[0];
			$au=$row[0];
		}}
		else{
		$sql="select authorityid from teachwithauthority where teachid='$_SESSION[usercode]'";
		$result=mysql_query($sql) or die("sql语句连接失败");
		while($row=mysql_fetch_array($result)){
		//	echo $row;
		//	echo $row[0];
			$au=$row[0];
		}
		}
	class person{
	private $name;
	private $id;
	private $auth;
	function __construct($a){
		$this->id=$_SESSION['usercode'];
		$this->name=$_SESSION['admin'];
		$this->auth=$a;
	}
	function getauth(){
		$arr=explode(",",$this->auth);
	return $arr;
	}
	}
	$user=new person($au);
	$_SESSION['user']=$user;
?>